<?php
class ActionPollsChoicesController extends AppController{
    
    public function addChoice(){
        if (!empty($this->request->data)){
            $data = $this->request->data;
            
            $data = $this->ActionPollsChoice->save($data);
            $id = $data['ActionPollsChoice']['id'];
        }
        else{
            $id = 0;
        }
        
        $this->set('id', $id);
    }
    
    
    public function delChoice($id){
        $this->ActionPollsChoice->delete($id);
        $this->render(false);
    }
    
    public function getChoices($idQuestion){
        $data = $this->ActionPollsChoice->find('all', array(
            'conditions' => array(
                'ActionPollsChoice.questions_id' => $idQuestion
            )
        ));
        $this->set('data' , $data);
    }
    
}

?>
